package com.foreveross.proxyip.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Globle {
	
	private static Globle loadConfigUtil =null ;
	
	
	private Properties configProperties=null;
	
	
	private static final String CONFIG_PROPERTIES = "/proxyService.properties";
	
	private static final String CHECK_URL_SITE = "";
	
	public synchronized static Globle getInstance(){
		if(loadConfigUtil==null){
			loadConfigUtil = new Globle();
		}
		return loadConfigUtil;
	}
	
	public Properties getProperties(){
		if(this.configProperties==null){
			loadConfigProperties();
		}
		return this.configProperties;
	}
	
	/**
	 * 根据键值获取系统初始化值
	 * @param key
	 * @return
	 */
	public String getValue(String key){
		if(configProperties==null){
			loadConfigProperties();
		}
		String replaceTagInfo=configProperties.getProperty(key);
		return replaceTagInfo;
	}
	
	/**
	 * 加载系统初始化文件
	 */
	private void loadConfigProperties(){
		configProperties = new Properties();
		InputStream is = getClass().getResourceAsStream(CONFIG_PROPERTIES);
		try {
			configProperties.load(is);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
